@extends('layouts.app')

@section('title', '提现申请')

@section('css-import')
<style type="text/css">
	.page-s{
		display: inline-block;
		padding-bottom: 0px;
		margin: 29px 9px;
		border-radius: 4px;
		float:  right;
	}
	.cardnumberinput{
		border: none;
	}
</style>
@endsection

@section('content-fluid')
<div class="row">
	<!-- BASIC TABLE -->
	<div class="panel">
		<div class="panel-heading">
			<h3 class="panel-title">提现申请</h3>
		</div>
		<div class="panel-body">
			<table class="table table-hover">
				<thead>
					<tr>
						<th>#</th>
						<th>申请商家</th>
						<th>持卡人</th>
						<th>提现金额</th>
						<th>银行卡号</th>
						<th>所属银行</th>
						<th>开户行</th>
						<th>手机</th>
						<th>处理进度</th>
						<th>备注</th>
						<th>申请时间</th>
						<th class="{{power_if('*')}}">操作</th>
					</tr>
				</thead>
				<tbody>
					@foreach($exdata as $k=>$v)
					<tr>
						<td class="extractid">{{$v->extract_id}}</td>
						<td style="width:100px;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;display: block;"><a href="/shopDetails?shopid={{$v->shop_id}}" title="{{$v->shop_name}}">{{$v->shop_name ?? $v->company_name}}</a></td>
						<td class="extractname">{{$v->bank_name}}</td>
						<td>{{$v->amount}}</td>
						<td class="cardnumber"><input type="text" readonly value="{{$v->bank_number}}" class="cardnumberinput"></td>
						<td class="bank_number">{{$v->bank_number}}</td>
						<td>{{$v->openbank}}</td>
						<td>{{$v->shop_tel}}</td>
						<td>{{$status_de[$v->extract_status]}}</td>
						<td>{{$v->extract_desc ?? '无'}}</td>
						<td>{{$v->insert_time}}</td>
						<td class="bankcz bhextr{{$v->extract_id}} {{power_if('*')}}">
							@if($v->extract_status==1)
							<a href="javascript:void(0);" class="extract-ks">开始处理</a> 
							<a href="javascript:void(0);" class="extract-bh" data-toggle="modal" data-target="#exampleModal" data-whatever="{{$v->extract_id}}">驳回</a>
							@elseif($v->extract_status==2)
							<a href="javascript:void(0);" class="extract-ycl">已处理</a>
							<a href="javascript:void(0);" class="extract-bh" data-toggle="modal" data-target="#exampleModal" data-whatever="{{$v->extract_id}}">驳回</a>
							@elseif($v->extract_status==3)
							处理完成
							@elseif($v->extract_status==4)
							正在修改
							@endif
						</td>
					</tr>
					@endforeach
				</tbody>
			</table>
			{{ $exdata->links() }}
			<div class="page-s">本页共{{ $exdata->count() }}条</div>
			<div class="page-s">共{{ $exdata->total() }}条</div>
			<div class="page-s">当前第{{ $exdata->currentPage() }}页</div>
			<div class="page-s">共{{ $exdata->lastPage() }}页</div>
		</div>
	</div>
	<!-- END BASIC TABLE -->
	<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel">
	  <div class="modal-dialog" role="document">
	    <div class="modal-content">
	      <div class="modal-header">
	        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
	        <h4 class="modal-title" id="exampleModalLabel">驳回的理由</h4>
	      </div>
	      <form name="bhform">
	      <div class="modal-body">
	        
	          <div class="form-group">
	            <label for="message-text" class="control-label">说明理由:</label>
	            <textarea class="form-control" id="message-text" name="explaim"></textarea>
	          </div>
	          <input type="hidden" name="extractid" value="">
	      </div>
	      <div class="modal-footer">
	        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
	        <button type="button" class="btn btn-primary confirmbh" >确认驳回</button>
	      </div>
	      </form>
	    </div>
	  </div>
	</div>
</div>
@endsection

@section('js-import')
<script type="text/javascript" src="{{config('app.inlet_src')}}a/js/extract.js"></script>
<script type="text/javascript" src="{{config('app.inlet_src')}}a/js/bankcard.js"></script>
<script type="text/javascript">
	$('.bank_number').each(function(){
		var banknumber = $(this).html();
		var bank = bankCardAttribution($(this).html())
		if(bank != 'error'){
			$(this).html(bank.bankName+' - '+bank.cardTypeName)
		}else{
			$(this).html("未识别")
		}
		$.get("https://ccdcapi.alipay.com/validateAndCacheCardInfo.json?_input_charset=utf-8&cardNo=" + banknumber + "&cardBinCheck=true",{}, function(res) {
			console.log(res)
            
          },'json');
	});
</script>
@endsection